import { PlusOutlined } from "@ant-design/icons";
import { Button } from "antd";
import React, { useEffect, useState } from "react";
import { history } from "umi";
import "./index.less";

const Register: React.FC = () => {
  const [myMap, setMyMap] = useState(new Map());
  // 在 useEffect 钩子中进行初始的设置
  useEffect(() => {
    setMyMap(
      new Map([
        ["home", "/"],
        ["", "/"],
      ])
    );
  }, []);

  const toRedirect = (value: string) => {
    history.push(myMap.get(value));
  };

  return (
    <div className="register">
      <div className="title">Register License Plate Number</div>
      <div className="register-content">
        <p className="text">License Plate Number Information</p>
        <Button
          className="add-btn"
          icon={<PlusOutlined />}
          onClick={() => history.push("/register/details")}
          type="default"
          size={"middle"}
        >
          Add License Plate Number
        </Button>
      </div>
    </div>
  );
};

export default Register;
